/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.OneToMany;
// Additional imports
import java.util.List;


/**
 *
 * @author NGUYEN CONG DAT
 */
@Entity
public class PurchasedGrouponEntity implements Serializable {
    private static long serialVersionUID = 1L;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public static void setSerialVersionUID(long aSerialVersionUID) {
        serialVersionUID = aSerialVersionUID;
    }
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String confirmationId;
    private Integer quantity = 1;
    private String status;
    @OneToOne(mappedBy="purchasedGroupon")
    private GrouponPaymentItemEntity grouponPaymentItem;
    @OneToMany(mappedBy="purchasedGroupon")
    private List<TransactionsEntity> transactions = new ArrayList<TransactionsEntity>();
    @OneToMany(mappedBy="purchasedGroupon")
    private List<IssuedGrouponEntity> issuedGroupons = new ArrayList<IssuedGrouponEntity>();
    @ManyToOne
    private GrouponEntity groupon;
    @ManyToOne
    private TouristAccountEntity tourist;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getId() != null ? getId().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PurchasedGrouponEntity)) {
            return false;
        }
        PurchasedGrouponEntity other = (PurchasedGrouponEntity) object;
        if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.PurchasedGrouponEntity[ id=" + getId() + " ]";
    }

    public String getConfirmationId() {
        return confirmationId;
    }

    public void setConfirmationId(String confirmationId) {
        this.confirmationId = confirmationId;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public GrouponPaymentItemEntity getGrouponPaymentItem() {
        return grouponPaymentItem;
    }

    public void setGrouponPaymentItem(GrouponPaymentItemEntity grouponPaymentItem) {
        this.grouponPaymentItem = grouponPaymentItem;
    }

    public TouristAccountEntity getTourist() {
        return tourist;
    }

    public void setTourist(TouristAccountEntity tourist) {
        this.tourist = tourist;
    }

    public GrouponEntity getGroupon() {
        return groupon;
    }

    public void setGroupon(GrouponEntity groupon) {
        this.groupon = groupon;
    }

    public List<IssuedGrouponEntity> getIssuedGroupons() {
        return issuedGroupons;
    }

    public void setIssuedGroupons(List<IssuedGrouponEntity> issuedGroupons) {
        this.issuedGroupons = issuedGroupons;
    }

    public List<TransactionsEntity> getTransactions() {
        return transactions;
    }

    public void setTransactions(List<TransactionsEntity> transactions) {
        this.transactions = transactions;
    }
    
}
